Skip to content

Make CustomEventNamesResolver a fun interface for SAM conversion#57112

Closed
cortinico wants to merge 1 commit into
react:mainfrom
cortinico:export-D107891295
Closed

Make CustomEventNamesResolver a fun interface for SAM conversion#57112
cortinico wants to merge 1 commit into
react:mainfrom
cortinico:export-D107891295

Conversation

@cortinico

Copy link
Copy Markdown
Contributor

Summary:
UIManagerModule was recently converted from Java to Kotlin. The nested
CustomEventNamesResolver interface has a single abstract method, but
was declared as a regular interface rather than fun interface.

In Java, single-method interfaces support SAM (Single Abstract Method)
conversion in Kotlin callers. After the Kotlin conversion, SAM conversion
no longer works unless the interface is declared as fun interface.

This breaks downstream libraries like react-native-reanimated that use
lambda syntax to instantiate CustomEventNamesResolver:

UIManagerModule.CustomEventNamesResolver { eventName -> ... }

Adding fun restores SAM conversion support. This is backward compatible
— existing object : CustomEventNamesResolver { ... } code continues to work.

Differential Revision: D107891295

Summary:
`UIManagerModule` was recently converted from Java to Kotlin. The nested
`CustomEventNamesResolver` interface has a single abstract method, but
was declared as a regular `interface` rather than `fun interface`.

In Java, single-method interfaces support SAM (Single Abstract Method)
conversion in Kotlin callers. After the Kotlin conversion, SAM conversion
no longer works unless the interface is declared as `fun interface`.

This breaks downstream libraries like `react-native-reanimated` that use
lambda syntax to instantiate `CustomEventNamesResolver`:
```
UIManagerModule.CustomEventNamesResolver { eventName -> ... }
```

Adding `fun` restores SAM conversion support. This is backward compatible
— existing `object : CustomEventNamesResolver { ... }` code continues to work.

Differential Revision: D107891295
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jun 8, 2026
@facebook-github-tools facebook-github-tools Bot added p: Facebook Partner: Facebook Partner labels Jun 8, 2026
@meta-codesync

meta-codesync Bot commented Jun 8, 2026

Copy link
Copy Markdown

@cortinico has exported this pull request. If you are a Meta employee, you can view the originating Diff in D107891295.

@meta-codesync meta-codesync Bot closed this in df4cadc Jun 8, 2026
@facebook-github-tools facebook-github-tools Bot added the Merged This PR has been merged. label Jun 8, 2026
@meta-codesync

meta-codesync Bot commented Jun 8, 2026

Copy link
Copy Markdown

This pull request has been merged in df4cadc.

@react-native-bot

Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by @cortinico in df4cadc

When will my fix make it into a release? | How to file a pick request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants